# -*- coding:UTF-8 -*-
"""
@Project : SeleniumAutoTest
@File    : example7-lastest.py
@IDE     : PyCharm
@Author  : WorldWind(1772830365@qq.com)
@Address : China - HeiLongjiang - Herbin
@Date    : 2025/8/3 下午6:34
"""
from selenium import webdriver
from time import sleep
from selenium.webdriver.common.by import By
from selenium.webdriver.chrome.service import Service
from selenium.webdriver.support.wait import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
from selenium.webdriver.common.action_chains import ActionChains

service = Service("D:\chromedriver-win64\chromedriver.exe")  # 配置chromedriver文件
dr = webdriver.Chrome(service=service)
# dr.maximize_window()
dr.get("https://www.baidu.com")
# moreLink = dr.find_element(By.LINK_TEXT, '更多')
# ActionChains(dr).move_to_element(moreLink).perform()  # 鼠标悬浮 一定要加perfrom()方法
# sleep(10)
# dr.find_element(By.XPATH, '//*[@id="s-top-more"]/div[5]/a/div').click()
# ActionChains(dr).context_click(dr.find_element(By.LINK_TEXT, '新闻')).perform()  # 右键页面
ActionChains(dr).move_to_element(dr.find_element(By.LINK_TEXT, '新闻')).move_to_element(
    dr.find_element(By.LINK_TEXT, '地图')).perform()
sleep(10)
